package com.example.webgobang.mapper;

import com.example.webgobang.model.domin.ChessHistory;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

@Mapper
public interface ChessHistoryMapper {
    @Insert("insert into chess_history (room_id, history, user_id_1, username1, " +
            "user_id_2, username2, black_user_id, winner_id)" +
            "values (#{roomId}, #{history}, #{userId1}, #{username1}, " +
            "#{userId2}, #{username2}, #{blackUserId}, #{winnerId})")
    void insertHistory(ChessHistory chessHistory);

    @Select("select * from chess_history where room_id = #{roomId}")
    ChessHistory selectHistoryByRoomId(String roomId);
}
